import mock from 'mockjs'

// 登录请求
mock.mock('/mock/login', 'post', config => {
	let {
		user,
		pass
	} = JSON.parse(config.body)
	console.log(user, pass)
	if (user == '1111' && pass == 'aa') {
		return {
			code: 1,
			msg: 'success',
			token: '12345678'
		}
	} else {
		return {
			code: 0,
			msg: 'fail'
		}
	}
})

// 注册
mock.mock('/mock/register', 'post', {
	code: 1,
	msg: '注册成功',
})

// 首页功能模块
mock.mock('/api/home/list', 'get', {
	code: 1,
	msg: 'success',
	data: [{
			title: '车型大全',
			img: '../../static/imgs/type.png',
			path: '/pages/moto/moto'
		},
		{
			title: '排行榜',
			img: '../../static/imgs/ranking_list.png',
			path: '/pages/ranking/ranking'
		},
		{
			title: '经销商',
			img: '../../static/imgs/agency.png',
			path: '/pages/agency/agency'
		}
	]
})

// 首页博客
mock.mock('/api/blog/list', 'get', {
	code: 1,
	msg: 'success',
	"data|5": [{
		blog_id: '@string("number",10)',
		blog_title: '2022款KTM390ADV，满足欧五排放，采用全新电辅系统',
		blog_postedTime: '@date("yyyy-MM-dd")',
		blog_author: 'DQ',
		author_id: '@string("number",10)',
		browse: '@integer(0,10000)',
		author_profile: 'https://imgs2.58moto.com/forum/20211206/a002b9ad7c934898a37351f2aeebd8cc.jpeg!nowater600?_1057_793',
		imgs: [
			'https://imgs2.58moto.com/forum/20211206/0d5c3cb324184c7eb1e2eb28f37a249f.jpeg!nowater600?_1067_800',
			'https://imgs2.58moto.com/forum/20211206/430cc7554f7f4e28b467ce1e5285dd67.jpeg!nowater600?_1067_800',
			'https://imgs2.58moto.com/forum/20211206/433642d2fa9b4d32890af75b970b68f6.jpeg!nowater600?_1052_789',
			'https://imgs2.58moto.com/forum/20211206/ba1310e2aa674f0d819809aa530f4e15.jpeg!nowater600?_1067_800',
			'https://imgs2.58moto.com/forum/20211206/a002b9ad7c934898a37351f2aeebd8cc.jpeg!nowater600?_1057_793',
			'https://imgs2.58moto.com/nowater/20230827/2_2/hNe8_5090314313961.jpeg!nowater600?_1080_648',
			'https://imgs2.58moto.com/forum/20230809/20230809152623_zpvs.jpg!nowater600?_1079_757'
		],
		blog_article: 'KTM旗下的390车系一直以来都是市场上的宠儿，车友眼中性能的代名词。而390 Adventure作为整个系列中的越野拉力车型担当，车迷对它的呼声甚高。自从2019年在EICM米兰车长亮相，去年上市之后，市场对它的好评还是蛮多的。'

	}]
})

// 首页轮播图照片
mock.mock('/mock/home/swipe/imgs', 'get', {
	code: 1,
	msg: 'success',
	data: [
		'https://imgs2.58moto.com/forum/20211206/0d5c3cb324184c7eb1e2eb28f37a249f.jpeg!nowater600?_1067_800',
		'https://imgs2.58moto.com/forum/20211206/1f4debd56500477ea99471efca834e30.jpeg!nowater600?_2949_1474',
		'https://imgs2.58moto.com/forum/20211207/nigBPBY7ZDK7.jpeg!nowater600?_640_235'
	]
})

// 摩友圈动态
mock.mock('/mock/blog/dynamic', 'get', {
	code: 1,
	msg: 'success',
	data: [{
			id: '12345',
			profile: '../../static/profile.png',
			text: '斯大法官符合国家健康环境很好广泛的撒啊',
			name: '士大夫十',
			imgs: [
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597743678.jpeg!nowater600?_1440_1080',
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597743091.jpeg!nowater600?_1440_1080',
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597611586.jpeg!nowater600?_1600_1080',
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597614080.jpeg!nowater600?_1600_1080',
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597612604.jpeg!nowater600?_1600_1080',
				'https://imgs2.58moto.com/forum/20211030/9517182_1635597612087.jpeg!nowater600?_1600_1080'
			],
			time: '2023-9-20',
			like: 123
		}

	]
})

// 博客详情
mock.mock('/mock/moto/bolg/article', 'post', {
	code: 1,
	msg: 'success',
	data: {
		bolgauthor: '@cname',
		authorProfile: mock.Random.image('200x200', '#50B347', '#fff', '摩托帝'), // 作者头像
		"bolgArticle|10": ['@cparagraph'], // 文章正文
		bolgId: '@string("number",10)', // 博客 id
		bolgSoetld: '@string("number",10)', // 博客分类id
		bolgTitle: '@ctitle(8,18)', // 标题
		bolgWatch: '@integer(0,10000)', // '浏览量'
		"imgs|20": [mock.Random.image('200x200', '#50B347', '#fff', '假数据')], // 正文图片
		pubTime: '@date("yyyy-MM-dd")', // 发表时间
		uid: '@string("number",10)', // 作者id
		likess: '@integer(0,10000)', // 点赞量
		collect: '@integer(0,10000)', // 收藏量
	}

})

// 商品页 模块列表
mock.mock('/api/shop/itemList', 'get', {
	code: 1,
	msg: 'success',
	data: [{
			title: '热销装备',
			img: '../../static/shop_itemList/s1.png'
		},
		{
			title: '秋装上新',
			img: '../../static/shop_itemList/s2.png'
		},
		{
			title: '新人必买',
			img: '../../static/shop_itemList/s3.png'
		},
		{
			title: '超跑装备',
			img: '../../static/shop_itemList/s4.png'
		},
		{
			title: '断码清仓',
			img: '../../static/shop_itemList/s5.png'
		},
	]
})

// 商品页 限时秒杀
mock.mock('/api/shop/seckill/list', 'get', {
	code: 1,
	msg: 'success',
	data: [{
			price: '159.99',
			img: '../../static/seckill/x1.png'
		},
		{
			price: '299.98',
			img: '../../static/seckill/x2.png'
		},
		{
			price: '1498',
			img: '../../static/seckill/x3.png'
		},
		{
			price: '459',
			img: '../../static/seckill/x4.png'
		},
		{
			price: '699',
			img: '../../static/seckill/x5.png'
		},
	]
})

// 商品页轮播图
mock.mock('/api/shop/swipe', 'get', {
	code: 1,
	msg: 'success',
	data: [
		'../../static/shop_banner/b1.png',
		'../../static/shop_banner/b2.png',
		'../../static/shop_banner/b3.png',
		'../../static/shop_banner/b4.png',
	]
})

//  商城商品列表
mock.mock('/api/shop/goods', 'get', {
	code: 1,
	msg: 'success',
	"data|20": [{
		id: '@string("number",10)',
		title: '@ctitle(8, 18)',
		price: '@integer(5,300)',
		count: '@integer(60, 100)',
		img: mock.Random.image('200x200', '#50B347', '#FFF', '假数据'),
		descr: '@cparagraph'
	}]
})

// 地址管理
mock.mock('/api/address/list', 'get', {
	code: 1,
	msg: 'suucess',
	"data|5": [{
		id: '@string("number",10)',
		prov: '@province',
		city: '@city',
		area: '@county',
		info: '@ctitle(8, 18)',
		name: '@cname',
		tel: '@string("number",11)',
		address: '@county(true)' + '@ctitle(5,10)'
	}],
})